package com.yunhe.estatemanage.client.fallback;

import com.yunhe.common.model.ResultObject;
import com.yunhe.common.model.authority.MessageCenter;
import com.yunhe.common.model.authority.RealStation;
import com.yunhe.common.model.authority.User;
import com.yunhe.common.model.authority.UserProjectOrg;
import com.yunhe.common.model.company.Company;
import com.yunhe.common.util.FallbackUtil;
import com.yunhe.estatemanage.client.AuthorityClient;
import feign.hystrix.FallbackFactory;
import org.springframework.http.ResponseEntity;

import java.util.List;
import java.util.Map;

/**
 * @ClassName: AuthorityClientFallbackFactory
 * @Description:
 * @author: GongDaCheng
 * @Date: 9:58 2021/9/8
 */
public class AuthorityClientFallbackFactory implements FallbackFactory<AuthorityClient> {
    @Override
    public AuthorityClient create(Throwable cause) {
        return new AuthorityClient() {
            @Override
            public ResponseEntity<ResultObject> searchStationAndOfficeByStationId(Long stationId) {
                return FallbackUtil.getDefaultFallBack();
            }

            @Override
            public ResponseEntity<ResultObject<Iterable<MessageCenter>>> batchCreateMessageCenter(List<MessageCenter> dataLists) {
                return FallbackUtil.getDefaultFallBack();
            }

            @Override
            public ResponseEntity<ResultObject<List<User>>> findStationUserByStationId(Long stationId) {
                return FallbackUtil.getDefaultFallBack();
            }

            @Override
            public ResponseEntity<ResultObject<List<UserProjectOrg>>> getUserByOrgIdAndStationId(Long orgId, Long stationId) {
                return FallbackUtil.getDefaultFallBack();
            }

            @Override
            public ResponseEntity<ResultObject<Company>> getCompanyById(Long id) {
                return FallbackUtil.getDefaultFallBack();
            }

            @Override
            public ResponseEntity<ResultObject<RealStation>> searchRealStationById(Long id) {
                return FallbackUtil.getDefaultFallBack();
            }

            @Override
            public ResponseEntity<ResultObject> pushMessageByUserIds(String userIds, String notificationTitle, String msgContent, Map<String, String> extras) {
                return FallbackUtil.getDefaultFallBack();
            }

            @Override
            public ResponseEntity<ResultObject> pushMessageByStationId(Long stationId, String notificationTitle, String msgContent, Map<String, String> extras) {
                return FallbackUtil.getDefaultFallBack();
            }
        };
    }
}
